﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Text;
using OTS.Model;
using OTS.BLL;

public partial class Evaluation_management : OTS.MemberPage
{
    protected string strConent;
    custom cus = new custom();
    List<saleOrder> sOrderList = new List<saleOrder>();
    SaleOrderBLL sOderBLL = new SaleOrderBLL();
    DataTable dt = new DataTable();
    StringBuilder sb = new StringBuilder();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!TestLogin(HttpContext.Current))
        {
            Response.Redirect("index.aspx");
            return;
        }
        if (!Page.IsPostBack)
        {
            BindEvaluation();
        }
    }

    protected void BindEvaluation() {
        cus = GetCustom(HttpContext.Current);
        sOrderList = sOderBLL.GetList("salesOrder.cusID=" + cus.cusID + " and status=2", true);

        if (sOrderList != null)
        {
            for (int i = 0; i < sOrderList.Count; i++)
            {
                sOrderList[i].list = sOderBLL.GetDetail(sOrderList[i].orderID);
                for (int j = 0; j < sOrderList[i].list.Count; j++)
                {
                    sb.Append("<tr>");
                    sb.Append("<td class=\"img-list\">");
                    sb.Append("<div class=\"divstyle\" style=\"border:0;\">");
                    sb.AppendFormat("<a target=\"_blank\" href=\"product.aspx?proID=" + sOrderList[i].list[j].proID + "\">");
                    sb.AppendFormat("<img src=\"" + PictureProcessing.ImgPathToThumbURL(sOrderList[i].list[j].bigImg_pic) + "\" alt=\"" + sOrderList[i].list[j].title + sOrderList[i].list[j].proNO + "\" />");
                    sb.Append("</a>");
                    sb.Append("</div>");
                    sb.Append("</td>");
                    sb.Append("<td>");
                    sb.AppendFormat("<a title=\"" + sOrderList[i].list[j].title + sOrderList[i].list[j].proNO + "\" href=\"product.aspx?proID=" + sOrderList[i].list[j].proID + "\">" + sOrderList[i].list[j].title + sOrderList[i].list[j].proNO + "</a><br />");
                    sb.Append("</td>");
                    sb.Append("<td>");
                    sb.AppendFormat("<span class=\"price1\">￥" + sOrderList[i].list[j].retailPrice + "</span>");
                    sb.Append("</td>");
                    sb.Append("<td>");

                    dt = sOderBLL.GetListE("cusID=" + cus.cusID + " and proID=" + sOrderList[i].list[j].proID);
                    if (dt.Rows.Count==0)
                    {
                        sb.Append("<a target=\"_blank\" href=\"Member-Evaluation.aspx?proID=" + sOrderList[i].list[j].proID + "\">评价</a>");
                    }
                    sb.Append("</td>");
                    sb.Append("</tr>");
                }
            }
            strConent = sb.ToString();
        }
    }
}
